package com.jlpay.openapi.demo.fund.deferred;

import com.jlpay.open.jlpay.sdk.java.model.BaseResponse;
import com.jlpay.open.jlpay.sdk.java.model.fund.deferred.request.FundUnfreezeRequest;
import com.jlpay.open.jlpay.sdk.java.utils.json.JsonUtils;
import com.jlpay.openapi.demo.JlpayOpenApiService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author chenjunhong
 * @since 2024/12/20
 */
public class FundUnfreezeService {

    private static final Logger LOGGER = LoggerFactory.getLogger(FundUnfreezeService.class);

    public static void main(String[] args) {
        FundUnfreezeRequest fundUnfreezeRequest = buildFundUnfreezeRequest();
        BaseResponse fundUnfreezeResponse = JlpayOpenApiService.openMerchService()
                .post(fundUnfreezeRequest, BaseResponse.class);
        LOGGER.info("资金解冻响应:{}", JsonUtils.toString(fundUnfreezeResponse));
    }

    private static FundUnfreezeRequest buildFundUnfreezeRequest() {
        FundUnfreezeRequest fundUnfreezeRequest = new FundUnfreezeRequest();
        fundUnfreezeRequest.setOutOrderId("test_unfreeze_202412200001");
        fundUnfreezeRequest.setOriOutOrderId("test_freeze_202412200001");
        fundUnfreezeRequest.setMerchNo("849551860110001");
        fundUnfreezeRequest.setUnfreezeAmount("100");
        fundUnfreezeRequest.setReason("解冻测试");
        fundUnfreezeRequest.setRemark("解冻测试");
        return fundUnfreezeRequest;
    }
}
